class point = 
  object
     val mutable x = 0
     val mutable y = 0
     method setX new_x = x <- new_x
     method setY new_y = y <- new_y
     method getX = x
     method getY = y
  end;;

class player = 
  object
    val mutable speed = 0
    val mutable status = "normal"
    val mutable p = new point
    val mutable v = new point  
    val mutable color = (1.,1.,0.)
    val mutable remaining_time = 0
    val mutable next_dir = 0
    val mutable now_dir = 0
    val mutable move_counter = 0
    val mutable r = 0.49
    method setSpeed new_speed = speed <- new_speed    
    method getSpeed = speed
    method setStatus new_status = status <- new_status    
    method getStatus = status
    method setPoint new_point = p <- new_point
    method getPoint = p
    method setVelocity new_point = v <- new_point
    method getVelocity = v
    method setColor new_color = color <- new_color    
    method getColor = color
    method setTime new_time = remaining_time <- new_time    
    method getTime = remaining_time
    method setNextDir new_next_dir = next_dir <- new_next_dir
    method getNextDir = next_dir
    method setNowDir new_now_dir = now_dir <- new_now_dir
    method getNowDir = now_dir
    method setMoveCounter new_move_counter = move_counter <- new_move_counter
    method getMoveCounter = move_counter
    method setRadius new_radius = r <- new_radius
    method getRadius = r
  end;;

class item = 
  object 
    val mutable speed = 0
    val mutable i_type = 0
    val mutable duration = 0
    val mutable p = new point  
    val mutable v = new point  
    val mutable color = (1.,1.,1.)
    val mutable r = 0.0
    val mutable level = 0
    val mutable score = 10
    val mutable next_dir = 0
    val mutable now_dir = 0
    val mutable move_counter = 0
    method setSpeed new_speed = speed <- new_speed    
    method getSpeed = speed
    method setType new_type = i_type <- new_type
    method getType = i_type
    method setDuration new_duration = duration <- new_duration    
    method getDuration = duration
    method setPoint new_point = p <- new_point
    method getPoint = p
    method setVelocity new_point = v <- new_point
    method getVelocity = v
    method setColor new_color = color <- new_color    
    method getColor = color
    method setNextDir new_next_dir = next_dir <- new_next_dir
    method getNextDir = next_dir
    method setNowDir new_now_dir = now_dir <- new_now_dir
    method getNowDir = now_dir
    method setMoveCounter new_move_counter = move_counter <- new_move_counter
    method getMoveCounter = move_counter
    method setRadius new_radius = r <- new_radius
    method getRadius = r
    method setLevel new_level = level <- new_level
    method getLevel = level
    method setScore new_score = score <- new_score
    method getScore = score
  end;;

class gamemap =
  object
    val mutable pacman = new player     
    val mutable list_bar: item list = []
    val mutable list_ghost: item list = []
    val mutable list_gift: item list = []
    method setPlayer new_player = pacman <- new_player
    method getPlayer = pacman
    method addBar new_item = list_bar <- new_item::list_bar
    method getBars = list_bar
    method addGhost new_item = list_ghost <- new_item::list_ghost
    method getGhosts = list_ghost
    method addGift new_item = list_gift <- new_item::list_gift
    method getGifts = list_gift
    method assignGhosts new_list = list_ghost <- new_list;
    method assignBars new_list = list_bar <-new_list;
    method assignGifts new_list = list_gift <-new_list;
  end;;

